Carbon


NewString

Header: TextUtils.h Carbon status: Supported

Allocates memory in the heap for a string, copies its contents, and produces a handle for the heap version of the string.

StringHandle NewString (
    ConstStr255Param theString
);
Parameter descriptions
theString

A Pascal string that you want copied onto the heap.

function result

A handle to the newly allocated string. If the string cannot be allocated, NewString returns NULL. The size of the allocated string is based on the actual length of theString, which may not be 255 bytes.

DISCUSSION

Before using Pascal string functions that can change the length of the string, it is a good idea to maximize the size of the string object on the heap. You can call either the SetString function or the Memory Manager function SetHandleSize to modify the string’s size.

SPECIAL CONSIDERATIONS

NewString may move memory; your application should not call this function at interrupt time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)